<?php
namespace App\Modules\RoleGroup;

use App\Modules\AdapterApi;
use App\Services\User\UserIndex;
/**
 * 对角色管理的操作
 * @author adv30 <adv30@126.com> \app\serverauth\service\role\Role
 */
class RoleGroup extends AdapterApi
{
    // 增加一个角色组
    public function add(): array
    {
        $data = pick_array($this->postData,['name','role_ids']);

        return UserIndex::RoleGroup()->add($data);
    }
    // 禁用一个角色组
    public function stop(): array
    {
        $data = pick_array($this->postData,['id','name']);
        return UserIndex::RoleGroup()->stop($data);
    }
    // 获取角色组列表分页数据
    public function list(): array
    {
        $data = pick_array($this->postData,['page','list_rows','status']);

        return UserIndex::RoleGroup()->list($data);
    }
    // 修改角色组资料
    public function edit(): array
    {
        $data = pick_array($this->postData,['name','role_ids','id']);

        return UserIndex::RoleGroup()->edit($data);
    }
//    // 将roleGroupIds解释成role_ids
//    public function roleGroupIdsToRoleIds(): array
//    {
//        $data = $this->haveIssetReceiveData(['group_ids' => '0']);
//        if ('0' === $data['group_ids']) {
//            return verify_err(null, '请传ids参数');
//        };
//        return $this->oneStepRun($data, 'serveruser/auth/RoleGroup/roleGroupIdsToRoleIds', 'roleGroupIdsToRoleIds');
//    }
}